{layout name="./base/base_back"}
	<link rel="stylesheet" type="text/css" href="/front/css/changepwd.css"/>
		<!--修改登录密码开始-->
		<div id="change-pwd-box">
			<div id="change-pwd">
				{include file="./navleft"}
				<div class="change-pwd-right">
					<div class="change-pwd-tit">修改登录密码</div>
					<form action="/userinfo/updatepasswordform" method="post">
						<div class="change-pwd-form">
							<div class="form-group-input">
								<label for="" class="form-label">原密码：<span id="old_psderror" style="color: red;"></span></label>
								<input type="password" name="old_psd"  placeholder="请输入您的账号密码"/>
							</div>
							<div class="form-group-input">
								<label for="" class="form-label">新密码：<span id="passworderror" style="color: red;"></span></label>
								<input type="password" name="password"  placeholder="请输入新密码"/>
							</div>
							<div class="form-group-input">
								<label for="" class="form-label">确认密码：<span id="repasswprderror" style="color: red;"></span></label>
								<input type="password" name="repassword"  placeholder="请再次输入密码"/>
							</div>
							<div class="form-group-input form-button">
								<button type="submit">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		<!--修改登录密码结束-->
<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript">
    	$(function(){
    		//旧密码
    		$("input[name='old_psd']").blur(function(){
    			var old_psd = $('input[name="old_psd"]').val();
    			//不能为空
    			if(!$.trim(old_psd)) {
					$("input[name='old_psd']").css({border: "1px solid red"});
					$("#old_psderror").html("请输入旧密码");
					return false;
    			}else{
    				$.get('/userinfo/checkoldpsd?old_psd='+$("input[name='old_psd']").val(),function(data) {
						$("input[name='old_psd']").css({border: "1px solid green"});
						$("#old_psderror").html("");
						if (data===0) {
							$("input[name='old_psd']").css({border: "1px solid red"});
							$("#old_psderror").html("密码不正确");
						}
					});
    			}
    			
    		})
    		//设置密码验证
    		$("input[name='password']").blur(function(){
    			var password = $('input[name="password"]').val();
    			//不能为空
    			if(!$.trim(password)) {
					$("input[name='password']").css({border: "1px solid red"});
					$("#passworderror").html("请输入密码");
					return false;
    			}else{
    				$.get('/userforgotpwd/checkpassword?password='+$("input[name='password']").val(),function(data) {
						$("input[name='password']").css({border: "1px solid green"});
						$("#passworderror").html("");
						if (data===0) {
							$("input[name='password']").css({border: "1px solid red"});
							$("#passworderror").html("密码应为6~16位的字母和数字组合");
						}
					});
    			}
    		});
    		//确认密码验证
    		$('input[name="repassword"]').blur(function(){
    			var repassword = $('input[name="repassword"]').val();
    			var password = $('input[name="password"]').val();
    			//不能为空
    			if(!$.trim(repassword)) {
					$("input[name='repassword']").css({border: "1px solid red"});
					$("#repasswprderror").html("再次输入");
					return false;
    			}else {
    				if (password===repassword) {
    					$("input[name='repassword']").css({border: "1px solid green"});
						$("#repasswprderror").html("");
    				}else{
    					$("input[name='repassword']").css({border: "1px solid red"});
						$("#repasswprderror").html("密码不一致");
    				}
    			}
    		})

    	})
</script>
